import request from '@/utils/request'

const userApi = {
  Login: '/api/v1/login',
  Logout: '/api/v1/logout',
  UserInfo:'/api/v1/user',
  createuser:"/api/v1/createuser",
  deleteuser:"/api/v1/user",
  Cookies:"/api/v1/cookie"
}

export const login  = (data) => {
  return request({
    url: userApi.Login,
    method: 'post',
    data: data,
  })
}

export const logout = () => {
  return request({
    url: userApi.Logout,
    method: 'post',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

//获取用户信息
export const UserList  = () => {
  return request({
    url: userApi.UserInfo,
    method: 'get',
  })
}

// 创建用户
export const CreateUser = (data) => {
  console.log(data)
  return request({
    url: userApi.createuser,
    method: 'post',
    data:data,
  })
}

export const SetCooke = () => {
  return request({
    url:userApi.Cookies,
    method:'get'
  })
}

// 删除用户
export const DeleteUser = (data) => {
    return request({
      url: userApi.deleteuser,
      method: 'delete',
      data:{id:data}
    })
  }